package training;

/**
 * @Author liangzai
 * @Description:
 */
public class J25_8_5_Training {
    //水果成篮 2
    public int numOfUnplacedFruits(int[] fruits, int[] baskets) {
        int n = fruits.length;
        int count = 0;
        int[] nums = new int[n];
        for (int i = 0; i < n; i++) {
            int j = 0;
            for (j = 0; j < n; j++) {
                if(nums[j] == 0 && fruits[i]<=baskets[j]){
                    nums[j] = 1;
                    count++;
                    break;
                }
            }
        }
        return n-count;
    }
}
